<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<html>

<head>
    <!-- 页面meta -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>学生管理</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name="viewport">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/plugins/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/plugins/adminLTE/css/AdminLTE.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/plugins/adminLTE/css/skins/_all-skins.min.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/style.css">
	<script src="${pageContext.request.contextPath}/plugins/jQuery/jquery-2.2.3.min.js"></script>
    <script src="${pageContext.request.contextPath}/plugins/bootstrap/js/bootstrap.min.js"></script>
    
    <script type="text/javascript">
	   		$(function(){
	            //为全选绑定点击事件
	            $("#selall").click(function(){
	                $("input[id^='box_']").prop("checked",this.checked);
	            });
	            
	            $("input[id^='box_']").click(function(){//点击每一个子checkbox，都会触发这个事件

	                //获取到下面所有checkbox
	                var boxs = $("input[id^='box_']");
	                $("#selall").attr("checked",boxs.length == boxs.filter(":checked").length);
	            });


	        });
	   		
	   		function deletesomeProdeuct() {
		    	var str="";
	   			var count=0;
	   			$("input[id^='box_']").each(function(){    
	   			    if($(this).is(':checked')){
	   			    	str+=$(this).val()+",";
	   			    	count++;
	   			    }else{}
	   			  });
	   			if(!confirm("确定删除这"+count+"个学生信息?")){
	   				return;
	   			}
	   			str = str.substr(0, str.length - 1);
	   			//console.log(str);
	   			window.location.href= "${pageContext.request.contextPath}/student/deleteSomeStudent?str="+str;
	   			
	   		}
		
    </script>

 
</head>

<body class="hold-transition skin-red sidebar-mini">
  <!-- .box-body -->
                
                    <div class="box-header with-border">
                        <h3 class="box-title">学生管理</h3>
                    </div>

                    <div class="box-body">

                        <!-- 数据表格 -->
                        <div class="table-box">

                            <!--工具栏-->
                            <div class="pull-left">
                                <div class="form-group form-inline">
                                    <div class="btn-group">
                                    </div>
                                </div>
                            </div>
                            <div class="box-tools pull-left">
                            		
                                <div class="form-group form-inline">
	                                    <div class="btn-group">
	                                        <button id="delete" type="button" class="btn btn-default" title="删除选中"  onclick="deletesomeProdeuct()"><i class="fa fa-trash-o"></i> 删除</button><!-- onclick单击鼠标时执行脚本 -->
	                                        <%--<button type="button" class="btn btn-default" title="返回列表" onclick="window.location.reload();"><i class="fa fa-refresh"></i> 返回</button>--%>
	                                    </div>
	                                
                                 	<%--  状态：<select onchange="self.location.href=options[selectedIndex].value"> 
                                 	 		<%	String op1 = "";
                                 	 			String op2 = "使用中";
                                 	 			String op3 = "未使用";	%>
                                        	<option value="${pageContext.request.contextPath}/Product/selectProduct?status=<%=op1%>">    </option>      <!--存疑  -->
                                        	<option value="${pageContext.request.contextPath}/Product/selectProduct?status=<%=op2%>">使用中</option> 
                                        	<option value="${pageContext.request.contextPath}/Product/selectProduct?status=<%=op3%>">未使用</option>                                    
                                        </select> --%>
                                        </div>
                            </div>
                            <%--<div class="box-tools pull-right">--%>
                                <%--<div class="has-feedback">--%>
                                        <%--<form action="${pageContext.request.contextPath}/student/findByName">--%>
							                  	<%--学生名称：	<input class="btn btn-default" name="str" id="str">--%>
							                  				<%--<input class="btn btn-default" type="submit" value="查询">--%>
							                  					<%----%>
										<%--</form>  --%>
                                <%--</div>--%>
                            <%--</div>--%>
                           
                            <!--工具栏/-->

			                  <!--数据列表-->
			                  <table id="dataList" class="table table-bordered table-striped table-hover dataTable">
			                      <thead>
			                          <tr>
			                              <th class="" style="padding-right:0px">
			                                  <input id="selall" type="checkbox" class="icheckbox_square-blue">
			                              </th>
                                          <th class="sorting">序号</th>
										  <th class="sorting_asc">学号</th>
									      <th class="sorting">姓名</th>
									      <th class="sorting">专业</th>
									      <th class="sorting">Java成绩</th>
									      <th class="sorting">数据库成绩</th>
									      <%--<th class="sorting">b</th>									     						--%>
					                      <%--<th class="text-center"></th>--%>
			                          </tr>
			                      </thead>
			                      <tbody>
			                      		
			                      		 <c:forEach var="i" items="${someStu}" varStatus="vs">

				                      			<c:if test="${someStu.size() == 0}">
					                      			<tr>
					                      				<td onclick="location.href='${pageContext.request.contextPath}/Product/productList'">没有场地,点击返回</td>
					                      			</tr>
				                      			</c:if>
					                          <tr>

                                                      <%--<td><input  type="checkbox"></td>--%>
			                               		      <td><input  type="checkbox" name="check" value="${i.id}" id="box_+${vs.count}"></td>
							                          <td>${vs.count}</td>
												      <td>${i.sid}</td>
												      <td>${i.sname}</td>
												      <td>${i.major}</td>
					                                  <td>${i.javagrade}</td>
					                                  <td>${i.databasegrade}</td>
				                                 <td class="text-center">
				                                 	  <button onclick="location.href='${pageContext.request.contextPath}/student/updateStu?id=${i.id}'"  class="btn bg-olive btn-xs" >修改</button>
				                                 	  <button onclick="location.href='${pageContext.request.contextPath}/student/deleteStu?sid=${i.sid}'"  class="btn bg-olive btn-xs" >删除</button>
				                                  </td>
					                          </tr>
				                          </c:forEach>
			                      </tbody>
			                  </table>
			                  <!--数据列表/-->                  
							 
                        </div>
                        <!-- 数据表格 /-->
                        
                        
                     </div>
                    <!-- /.box-body -->
		
</body>

</html>